<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <%@ page import = "java.sql.*" %>
    <%
    try{
    	/** Loading the driver*/
    	Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

    	/** Getting Connection*/
    	Connection con = DriverManager.getConnection("jdbc:odbc:jdbctest", "admin", "admin");
    	String s = null;
    	PreparedStatement st;
    	if (null == request.getParameter("id"))
    	{
    		
        	st = con.prepareStatement("delete * from student");
    		int ex = st.executeUpdate();
    		System.out.println("delete success!");

    		st.close();
    		con.close();
    		response.sendRedirect("http://localhost:8080/ex21/Ex22.jsp");
    	}else{
    	s = request.getParameter("id");
    	s.trim();
 
    	st = con.prepareStatement("delete from student where name=?");
		st.setString(1, s);
		int ex = st.executeUpdate();
		System.out.println("delete success!");

		st.close();

    	con.close();
    	response.sendRedirect("http://localhost:8080/ex21/Ex22.jsp");}
    }
    catch (Exception e)
    {
    	e.printStackTrace();
    }
    %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title></title>
</head>
<body>

</body>
</html>